package com.example.jwt;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.example.bean.UserBean;

public class JwtUtils {

    /**
     * 获取token
     * @param userBean
     * @return
     */
    public static String getToken(UserBean userBean) {
        String token = "";
        token = JWT.create()
                .withAudience(userBean.getId())
                .sign(Algorithm.HMAC256(userBean.getPassword()));
        return token;
    }
}
